<template>
	<view>
		<u-navbar title="提領" placeholder autoBack>
			<view class="flexright xiaohei" slot="right" @click="bangdingzh">
				<view class="toprightbtn">
					綁定帳號
				</view>
			</view>
		</u-navbar>
		<view class="mainpadding">
			<view class="ffffff shadow" style="border: 1rpx solid #e3e1e6;border-radius: 20rpx;">
				<view class="mainpadding" style="border-bottom: 1rpx dashed #e3e1e6;"
					@click="jumpurl('/pages/workbench/bangdingzh?type=1')">
					<view class="flexbetween" v-if="!currentid">
						<view class="main_size hei_text bold">選擇銀行帳戶</view>
						<u-icon name="arrow-right" color="#333" size="16"></u-icon>
					</view>
					<view class="flexbetween" v-if="currentid">
						<view class="">
							<view class="bold titletext margin_right2">{{seleckBankItem.bank}}
							</view>
							<view class="titletext bold margin_top1">{{seleckBankItem.num}}</view>
						</view>
						<u-icon name="arrow-right" color="#333" size="16"></u-icon>
					</view>
				</view>
				<view class="xiaohei titletext bold mainpadding" style="border-bottom: 1rpx dashed #e3e1e6;">
					電口支付 點數：<text class="xiaohong" style="font-size: 40rpx;">{{userInfo.countmoney}}</text>
				</view>
				<view class="flexbetween mainpadding">
					<view class="xiaohui bold" style="font-size: 40rpx;">$</view>
					<input type="text" placeholder="0" style="font-size: 40rpx;" v-model="txprice"
						class="xiaohong textright bold" />
				</view>
			</view>
			<view class="mainpadding_top ffffff radius">
				<view class="main_size hei_text bold">提領規則</view>
				<view class="xiaohui margin_top1">{{listbz}}</view>
			</view>
			<view class="submitbtn margin_top" @click="tixianbtn">提領</view>
			<view class="xiaohuang margin_top flexcenter" @click="tztxjl">提領記錄</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				listbz: "",
				show: false,
				wrzshow: false,
				paytype: 1,
				userInfo: {},
				txprice: "",
				//flag: true, //如果提現金额大于可提現金额为false
				rztext: "",
				withdrawal_bz: "", //提現备注  
				realname_status: "", //实名认证状态
				list: [],
				currentid: "",
				seleckBankItem: {}
			}
		},
		onLoad() {
			uni.$on("seleckBank", data => {
				this.currentid = data.id
				this.seleckBankItem = data
			})
			this.getInfo()
			this.beizhu()
		},
		onUnload() {
			uni.$off("seleckBank")
		},
		methods: {
			
			async getInfo() { //获取店鋪信息
				let res = await this.http.request('/api/shop/Shopdeail', 'POST', {
					shop_id: uni.getStorageSync("shop_id"),
				})
				if (res.code == 1) {
					uni.setStorageSync("appkey", res.data.appkey)
					uni.setStorageSync("hy_type", res.data.hy_type)
					uni.setStorageSync("opentable_status", res.data.opentable_status)
					uni.setStorageSync("is_sdkfp", res.data.is_sdkfp)
					uni.setStorageSync("is_call_sdkfp", res.data.is_call_sdkfp)
					uni.setStorageSync("is_pos_sdkfp", res.data.is_pos_sdkfp)
					uni.setStorageSync("houtel_type", res.data.houtel_type)
					this.userInfo = res.data
				}
			},
			// 绑定账户
			bangdingzh() {
				uni.navigateTo({
					url: '/pages/workbench/bangdingzh'
				})
			},
			beizhu() { //提現备注
				let _this = this
				httpRequest.request('/api/index/getConfigInfoItem', 'GET', {
					pidtype: "otherset",
					type: "shopwithdrawal_des"
				}).then(res => {
					this.listbz = res.data
				})
			},
			// 跳转提現記錄
			tztxjl() {
				uni.navigateTo({
					url: '/pages/workbench/tixianjl'
				})
			},
			tixianbtn() {
				/* this.show = true */
				let _this = this;
				if (!Number(this.txprice)) {
					httpRequest.toast("請輸入提領點數")
					return false
				}
				if (this.currentid == "") {
					httpRequest.toast("請選擇銀行卡")
					return false
				}
				httpRequest.request('/api/shop/addWithdrawal', 'GET', {
					price: this.txprice,
					shop_id: uni.getStorageSync("shop_id"),
					shop_bank_id: this.currentid
				}, false, false, true).then(res => {
					httpRequest.toast(res.msg);
					if (res.code == 1) {
						setTimeout(() => {
							uni.navigateBack(1)
						}, 1000)
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			close() { //提現弹出框
				this.show = false
			},
			wrzclose() { // 未认证弹框 
				this.wrzshow = false
			},
			alltx() { //全部提現
				this.txprice = this.userInfo.countmoney;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.bighuangsetext {
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFB800;
	}

	.toubutx {
		background-color: #FFB800;
	}

	.colour {
		color: #fff;
	}

	.renzbtn {
		width: 291.5rpx;
		height: 74rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #fff;
		border-top: 1rpx solid #E7E7E7;
		// border-right:1rpx solid #E7E7E7;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		border-radius: 0 0 20rpx 0;
		color: #228DFF;
	}

	::v-deep.u-radio-group {
		flex: none !important;
	}

	.quxiaobtn {
		border-radius: 0 0 0 20rpx;
		width: 291.5rpx;
		height: 74rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #fff;
		border-top: 1rpx solid #E7E7E7;
		border-right: 1rpx solid #E7E7E7;
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #666666;
	}

	.tanchuceng {
		padding: 40rpx 70rpx;
	}


	.querenbtn {
		border-radius: 40rpx;
		font-size: 32rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFFFFF;
		width: 328rpx;
		height: 64rpx;
		background-size: 100% 100%;
		display: flex;
		background-color: #FFB800;
		align-items: center;
		justify-content: center;
	}

	.hongstext {
		font-size: 26rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FF0303;
	}

	.huisetext {
		font-size: 26rpx;
		font-family: PingFang SC-Regular, PingFang SC;
		font-weight: 400;
		color: #666666;
	}


	.xiahuax {
		padding-bottom: 30rpx;
		border-bottom: 2rpx solid rgba(0, 0, 0, 0.05);
	}

	.huangsetext {
		font-size: 28rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #FFB800;
	}

	.sishitext {
		font-size: 40rpx;
		font-family: DIN Next LT Pro-Regular, DIN Next LT Pro;
		font-weight: 400;
		color: #333333;
	}

	.daheitext {
		font-size: 55rpx;
		font-family: DIN Next LT Pro-Regular, DIN Next LT Pro;
		font-weight: 500;
		color: #333333;
	}

	.neirong {
		position: relative;
		top: -80rpx;
	}

	.dbaitext {
		font-size: 40rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.xiaobtext {
		font-size: 24rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.margin_top7 {
		margin-top: 70rpx;
	}
</style>